#ifndef JEUX_H_INCLUDED
#define JEUX_H_INCLUDED
#include <allegro.h>
#include <stdio.h>

#define GFX_W 800
#define GFX_H 600
#define NB_IMAGES 16
BITMAP *Buffer;
	BITMAP *Background=NULL;
	BITMAP *BackgroundCol=NULL;
        BITMAP* Backplat=NULL;
 BITMAP *BackgroundAccueil=NULL;
        BITMAP *BackgroundWelc=NULL;
BITMAP *BackgroundGameover=NULL;
       BITMAP *BackgroundChoix=NULL;
BITMAP *BackgroundCader=NULL;
 
        BITMAP *BackgroundPause=NULL;
        BITMAP *BackgroundCa=NULL;
        BITMAP *BackgroundFin=NULL;


        BITMAP *BackgroundC1=NULL;
        BITMAP *BackgroundC2=NULL;
        BITMAP *BackgroundC3=NULL;
        BITMAP *BackgroundCv=NULL;
        BITMAP *BackgroundRe=NULL;


int compteur; float a,c,b; int d,f,e,g,h,k,l,m,n;
struct Personage {
	BITMAP * img_right[NB_IMAGES];
	
	
	float x, y;
	int direction; 
};
typedef struct Personage Personage;
struct plat{
BITMAP * img_plat[NB_IMAGES];
BITMAP * img_platcol[NB_IMAGES];
};
typedef struct plat plat;
int get_pixel(BITMAP* Buffer,int x,int y);



BITMAP* load_background_bmp(char chemin_background[]);
BITMAP* load_background1_bmp(char chemin_background_col[]);

void load_backplat_bmp(plat *p);


void draw_background(BITMAP *Background,BITMAP*Buffer);
void destroy_background(BITMAP * Background);


void draw_plat( plat p ,BITMAP*Buffer,float *a,int *pix3,int *pix1);
void destroy_plat(plat *p);


void load_backplatcol_bmp(plat *p);
void draw_platcol( plat p ,BITMAP*Buffer ,float *c,int pix3);
void destroy_platcol(plat *p);


void draw_backgroundcol(BITMAP *BackgroundCol,BITMAP*Buffer,float *b,int *pix3,int *pix1);



void load_5obza(Personage *men);
void destroy_5obza(Personage *men);
void init_5obza(Personage *men,int *compteur, float *a,float *c,float *b, int *d,int *f,int *e,int *g,int *h,int *k,int *l,int *m,int *n,int *o,int *r,int *s);



void move_5obza_right(Personage *men,int *compteur,BITMAP * Background,int *pix1);
void move_5obza_left(Personage *men,int *compteur,BITMAP * Background,int *pix2);
void gravity_5obza(Personage *men,BITMAP * Background,int *pix3,int *pix1);
void jump_5obza(Personage *men,BITMAP * Background,int *pix4,int *pix3,int *pix1); 

void move_5obza(Personage *men,int *compteur,BITMAP * Background,int *pix3,int *pix1,int *pix2,int *pix4);
void draw_5obza(Personage *men,BITMAP *Buffer, int *compteur);

void collision (Personage *men ,BITMAP *BackgroundCol , int *pix1,int *pix2,int *pix3,int *pix4,int*d);
void load_son(SAMPLE *music);
void jeux(BITMAP *BackgroundFin,BITMAP *BackgroundC1,BITMAP *BackgroundC2,BITMAP *BackgroundC3,BITMAP *BackgroundCol,BITMAP *Background,BITMAP *Buffer,plat p ,Personage *men ,int *pix1,int *pix2 ,int *pix3,int *pix4,float *a,float *b,int *d,int *o,int *compteur,int *h );
void acceuil(BITMAP *BackgroundAccueil,BITMAP *BackgroundWelc,BITMAP *Buffer,int *f);
void f_pause(BITMAP *BackgroundPause,BITMAP *BackgroundCa,BITMAP *Buffer,int *m,int *k,int *l,int *h);
void G_over(BITMAP *BackgroundGameover,BITMAP *BackgroundChoix,BITMAP *BackgroundCader,BITMAP *Buffer,Personage *men,int *compteur, float *a,float *c,float *b, int *d,int *f,int *e,int *g,int *h,int *k,int *l,int *m,int *n,int *o,int *r,int *s);

void vie(BITMAP *BackgroundGameover,BITMAP *BackgroundChoix, BITMAP *BackgroundCader,BITMAP *BackgroundRe,BITMAP *BackgroundCv, BITMAP *BackgroundC1,BITMAP *BackgroundC2,BITMAP *BackgroundC3,BITMAP *Buffer,Personage *men,int *compteur, float *a,float *c,float *b, int *d,int *f,int *e,int *g,int *h,int *k,int *l,int *m,int *n,int *o,int *r,int *s);
//void sauvgard(Personage *men,int *compteur, float *a,float *c,float *b, int *d,int *f,int *e,int *g,int *h,int *k,int *l,int *m,int *n,int *o,int *r,int *s);
//void charger(Personage *men,int *compteur, float *a,float *c,float *b, int *d,int *f,int *e,int *g,int *h,int *k,int *l,int *m,int *n,int *o,int *r,int *s);

#endif // JEUX_H_INCLUDED
